/**
 * 接口主函数
 * @param {Object} ctx HTTP上下文
 * @param {Object} db 数据管理器,如: { next: async function{}, ret: {} }
 * @return {Object} 执行结果
 */
async function main(ctx, db) {
	// 获取请求参数
	var req = ctx.request;
	var {
		query,
		body
	} = req;
	var ret;
	var plug = this.plugin();
	if (plug) {
		var options = plug.get_options();
		var user = await this.get_state(ctx, db);
		if (!options.salt) {
			options.salt = 'asd123';
		}
		if (!user) {
			delete options.salt;
		}
		ret = $.ret.obj(options);
	}
	return ret;
};

exports.main = main;